package code.google.jcontainer.test.extend;

import code.google.jcontainer.resolver.MethodAnnotationResolver;
import code.google.jcontainer.resolver.MethodResolveContext;
import code.google.jcontainer.resolver.ResolverException;

/**
 * @author <a href="mailto:jfox.young@gmail.com">Young Yang</a>, 2009-12-30 17:23:13
 */
public class DefaultWordAnnotationResolver implements MethodAnnotationResolver{

    public void resolveMethodAnnotationBeforeConstruct(MethodResolveContext methodResolveContext) throws ResolverException {

    }

    public void resolveMethodAnnotationAfterConstruct(MethodResolveContext methodResolveContext) throws ResolverException {

    }

    public void resolveMethodAnnotationBeforeMethod(MethodResolveContext methodResolveContext) throws ResolverException {
        // can get Container from methodResolveContext
        ExtendedContainer extendedContainer = (ExtendedContainer)methodResolveContext.getContainer();
        // call ExtendedContainer.getDefaultValue to get default value
        String defaultValue = extendedContainer.getDefaultWord();
        methodResolveContext.setParameters(new Object[]{defaultValue});
    }

    public void resolveMethodAnnotationAfterMethod(MethodResolveContext methodResolveContext) throws ResolverException {

    }

}
